<template>
  <div id="app">
    <div id="nav">

      <!--router-link 声明式导航 -->
      <router-link to="/">flex</router-link> |
      <router-link to="/about">About</router-link> |
      <router-link to="/tab">tab</router-link> |
      <span @click='gotab2'>tab2</span>
    </div>
    <router-view/>
  </div>
</template>


<script>
export default {
  methods:{
    gotab2(){
      /* 编程式导航 */
      this.$router.push('/tab2')
    }
  }
}
</script>


<style lang="less">
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
